package com.example.activity;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class MainActivity extends Activity {
	protected Button button;
	protected EditText edittext;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        edittext=(EditText) findViewById(R.id.jiemian1_et);
    }
    public void goToTwo(View v)
    {
    	Intent intent=new Intent(this,MainActivity2.class);
    	startActivityForResult(intent, 300);
    }
    public void onActivityResult(int requestCode,int resultCode,Intent data)
    {
    	super.onActivityResult(requestCode, resultCode, data);
    	System.out.println(requestCode);
    	switch (requestCode) {
		case 300:
			if(resultCode==RESULT_OK)
			{
				String phone=data.getStringExtra("phone");
				System.out.println(phone);
				edittext.setText(phone);
			}
			break;

		default:
			break;
		}
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
